<template>
  <div>
    <van-row type="flex" align="center" style="margin-top: 10px">
      <van-col span="2">
        <van-icon
          name="arrow-left"
          size="40"
          color="rgb(64, 150, 236)"
          @click="back"
        />
      </van-col>
      <van-col span="20"><span>注册</span></van-col>
    </van-row>
    <hr style="margin-top:20px,color:rgba(137, 162, 162, 0.1)" />
    <van-row type="flex" justify="center">
      <van-col span="12">
        <h1>汽配商城</h1>
      </van-col>
    </van-row>
    <van-form @submit="onSubmit">
      <div class="shuru">
        <van-field
          v-model="username"
          type="username"
          name="用户名"
          left-icon="phone-o"
          placeholder="请输入手机号码"
          :rules="[{ required: true, message: '请填用户名' }]"
        />
        <hr />
        <van-field
          v-model="sms"
          left-icon="passed"
          center
          clearable
          placeholder="请输入短信验证码"
        >
          <template #button>
            <van-button size="small" color="rgba(37, 139, 187, 0.82)" plain
              >发送验证码</van-button
            >
          </template>
        </van-field>
        <hr />
      </div>

      <van-row type="flex" justify="center" style="margin-top: 30px">
        <van-radio-group v-model="radio">
          <van-radio name="1" shape="square"
            >我已阅读并同意
            <span style="color: rgba(72, 175, 222, 0.82)" @click="useragree"
              >《用户协议》</span
            >
          </van-radio>
        </van-radio-group>
      </van-row>
      <div style="margin: 1.875rem">
        <van-button block type="info" native-type="submit" @click="setpassword"
          >下一步</van-button
        >
      </div>
    </van-form>
  </div>
</template>

<script>
export default {
  name: "Register",

  data() {
    return {
      username: "",
      password: "",
      radio: "",
    };
  },
  methods: {
    onSubmit(values) {
      console.log("submit", values);
    },
    setpassword() {
      this.$router.push("/setpassword");
    },
    useragree() {
      this.$router.push("/useragreement");
    },
    back() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less">
.van-col--8 {
  margin: 1.25rem;
}
.shuru {
  width: 80%;
  margin-left: 2.5rem;
}
</style>